Imports Microsoft.VisualBasic
Imports System.Data.Common

Public Class MySqlParameterCollection
    Inherits DbParameterCollection

    Private ReadOnly _coll As MySql.Data.MySqlClient.MySqlParameterCollection

    Sub New()

        Me._coll = New MySql.Data.MySqlClient.MySqlParameterCollection()

    End Sub

    Sub New(ByVal coll As MySql.Data.MySqlClient.MySqlParameterCollection)

        Me._coll = coll

    End Sub

    Public Overrides Function Add(ByVal value As Object) As Integer

        Dim param As MySqlParameter = value

        Return Me._coll.Add(CType(param._param, Object))

    End Function

    Public Overrides Sub AddRange(ByVal values As System.Array)

        For Each param As MySqlParameter In values
            Me._coll.Add(param._param)
        Next

    End Sub

    Public Overrides Sub Clear()

        Me._coll.Clear()

    End Sub

    Public Overloads Overrides Function Contains(ByVal value As Object) As Boolean

        Return Me._coll.Contains(value)

    End Function

    Public Overloads Overrides Function Contains(ByVal value As String) As Boolean

        Return Me._coll.Contains(value)

    End Function

    Public Overrides Sub CopyTo(ByVal array As System.Array, ByVal index As Integer)

        Me._coll.CopyTo(array, index)

    End Sub

    Public Overrides ReadOnly Property Count() As Integer
        Get
            Return Me._coll.Count
        End Get
    End Property

    Public Overrides Function GetEnumerator() As System.Collections.IEnumerator

        Throw New ApplicationException("Unsupported function.")

    End Function

    Protected Overloads Overrides Function GetParameter(ByVal index As Integer) As System.Data.Common.DbParameter

        Return New MySqlParameter(Me._coll.Item(index))

    End Function

    Protected Overloads Overrides Function GetParameter(ByVal parameterName As String) As System.Data.Common.DbParameter

        Return New MySqlParameter(Me._coll(parameterName))

    End Function

    Public Overloads Overrides Function IndexOf(ByVal value As Object) As Integer

        Return Me._coll.IndexOf(value)

    End Function

    Public Overloads Overrides Function IndexOf(ByVal parameterName As String) As Integer

        Return Me._coll.IndexOf(parameterName)

    End Function

    Public Overrides Sub Insert(ByVal index As Integer, ByVal value As Object)

        Me._coll.Insert(index, value)

    End Sub

    ''' <summary>
    ''' not implemented
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Overrides ReadOnly Property IsFixedSize() As Boolean
        Get

        End Get
    End Property

    ''' <summary>
    ''' not implemented
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Overrides ReadOnly Property IsReadOnly() As Boolean
        Get

        End Get
    End Property

    ''' <summary>
    ''' not implemented
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Overrides ReadOnly Property IsSynchronized() As Boolean
        Get

        End Get
    End Property

    Public Overrides Sub Remove(ByVal value As Object)

        Me._coll.Remove(value)

    End Sub

    Public Overloads Overrides Sub RemoveAt(ByVal index As Integer)

        Me._coll.RemoveAt(index)

    End Sub

    Public Overloads Overrides Sub RemoveAt(ByVal parameterName As String)

        Me._coll.RemoveAt(parameterName)

    End Sub

    Protected Overloads Overrides Sub SetParameter(ByVal index As Integer, ByVal value As System.Data.Common.DbParameter)

        Me._coll(index).Value = value

    End Sub

    Protected Overloads Overrides Sub SetParameter(ByVal parameterName As String, ByVal value As System.Data.Common.DbParameter)

        Me._coll(parameterName).Value = value

    End Sub

    Public Overrides ReadOnly Property SyncRoot() As Object
        Get
            Throw New ApplicationException("Unsupported property.")
        End Get
    End Property
End Class
